<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动画</title>
</head>

<body>
    <div class="haha" id="status" style="width:0%;height: 100px;background-color: #bfa;"></div>
</body>
<script>
    // 创建动画
    function updateProgress(){
        var div = document.getElementById('status');
        div.style.width = (parseInt(div.style.width,10)+5)+"%"
        if(div.style.width != "100%"){
            return requestAnimationFrame(updateProgress);
        }
    }
    // 使用动画
    var requestID = requestAnimationFrame(updateProgress);
    // 注销动画
    // window.cancelAnimationFrame(requestID);

</script>

</html>